<template>
  <draw-component
    :drawer-visible="state.show"
    size="820px"
    title="财务情况详情"
    :show-bottom-btn="false"
    @close-drawer="handleClose"
  >
    <table-page-content
      ref="tableRef"
      :loading="state.loading"
      :table-data="state.tableList"
      :table-headers="detailHeaders"
      :table-height="'75vh'"
      :is-pager="false"
    >
    </table-page-content>
    <template #footBtn>
      <el-button class="btn save" type="primary" @click="handleClose">关闭</el-button>
    </template>
  </draw-component>
</template>

<script lang="ts" setup>
import { detailHeaders } from '../config'
import { getDetailById } from '../api'
const state = reactive({
  loading: false,
  currentId: '',
  show: false,
  tableList: []
})
// 关闭回调
const handleClose = () => {
  state.show = false
  state.currentId = ''
  state.tableList = []
}
// 获取列表数据
const getList = () => {
  state.loading = true
  state.tableList = []
  getDetailById<any>(state.currentId)
    .then((res) => {
      state.tableList = res.data.enterpriseFinanceListResponseDtoList
      state.loading = false
    })
    .catch(() => {
      state.loading = false
    })
}
defineExpose({ state, getList })
</script>

<style lang="scss" scoped></style>
